# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Fangrui Song <i at maskray.me>

pkgname=ccls
pkgver=0.20220729
pkgrel=3
pkgdesc='C/C++/ObjC language server supporting cross references, hierarchies, completion and semantic highlighting'
arch=('loong64' 'x86_64')
url='https://github.com/MaskRay/ccls'
license=('Apache')
depends=('clang=15.0.7' 'llvm-libs' 'rapidjson')
makedepends=("cmake" "llvm")
conflicts=('ccls-git')
source=("https://github.com/MaskRay/$pkgname/archive/$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('63cb4eace1700118f9c8c4d2f4be40aac948f9c658485c8e3f49dcc863ce7bdd8b6de810b95ec8f46c943b65c8aa5fa643b110a6b981a2e43f57569d897d36c1')

build() {
  cd $pkgname-$pkgver
  cmake -H. -Bbuild -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_CXX_COMPILER=clang++ -DCLANG_LINK_CLANG_DYLIB=1
  cmake --build build
}

package() {
  cd $pkgname-$pkgver/build
  make DESTDIR="$pkgdir" install
}
